package com.aliengen.thingple.driverapp.network.api;

import com.android.volley.AuthFailureError;
import com.android.volley.Response;
import com.android.volley.toolbox.JsonObjectRequest;

import java.util.HashMap;
import java.util.Map;

/**
 * This class is part of the Thingple mobile application for the CMC168 Handheld reader.
 * <p/>
 * Copyright AlienGen Limited 2016. All rights reserved.
 *
 * @author Timothé Mermet-Buffet <tim@aliengen.com>
 */
public class Request extends JsonObjectRequest {
    protected Map<String, String> mHeaders = new HashMap<>();

    public Request(int method, String url, String body, Response.Listener listener, Response.ErrorListener errorListener)
    {
        super(method, url, body, listener, errorListener);
    }

    public Request(int method, String url, Response.Listener listener, Response.ErrorListener errorListener)
    {
        super(method, url, listener, errorListener);
    }

    public String addHeader(String key, String value)
    {
        return mHeaders.put(key, value);
    }

    @Override
    public Map<String, String> getHeaders() throws AuthFailureError {
        return mHeaders;
    }

}
